package com.zh.note.huawei.onehundred.太阳能板最大面积;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author: zhanghuan
 * @date: 2023/9/3 10:58
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // String line = sc.nextLine();
        String line = "10,9,8,7,6,5,4,3,2,1";
        String[] split = line.split(",");
        int[] nums = Arrays.stream(split).mapToInt(Integer::parseInt).toArray();
        int res = -1;
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                int min = findMinValue(nums, i, j);
                res = Math.max(res, (j - i) * min);

            }
        }
        System.out.println(res);

    }

    private static int findMinValue(int[] nums, int start, int end) {

        int minValue = Integer.MAX_VALUE;
        for (int i = start; i <= end; i++) {
            if (nums[i] < minValue) {
                minValue = nums[i];
            }
        }
        return minValue;
    }
}
